package com.baidu.dao;

import com.baidu.pojo.Exhibition;
import com.baidu.pojo.Order;
import com.baidu.pojo.Ticket;
import com.baidu.pojo.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface UserMapper {
    @Select("select * from users")
    public List<User> test();
//    登录
    @Select("SELECT * FROM users where uname=#{uname} AND upassword=#{upassword} AND pid=2")
    public User login(User user);

//    注册
    @Insert("INSERT INTO users(uname,upassword,utime,ucount,pid,ustate) VALUES(#{uname},#{upassword},#{utime},0,2,0)")
    public void regUser(User user);
//    查询用户
    @Select("SELECT * FROM users where uid=#{uid}")
    public User getUserById(Integer uid);
//    充钱/减钱 啦
    @Update("UPDATE users SET ucount=#{ucount} WHERE uid=#{uid}")
    public void addUserCount(User user);
//    个人信息修改
    @Update("UPDATE users SET uname=#{uname},upassword=#{upassword} WHERE uid=#{uid}")
    public void updateUser(User user);

}
